package com.itheima.a01mystream;

import java.util.ArrayList;
import java.util.Collections;

public class StreamDemo1 {
    public static void main(String[] args) {
        //stream流对数据的过滤

        //需要过滤的数据
        ArrayList<String> list = new ArrayList<String>();
        Collections.addAll(list, "A", "AB", "C", "AD", "AAE", "F", "G");

        //利用stream流进行过滤
        //stream相当于把数据放到流水线，filter相当于过滤器
        list.stream().filter(s->s.startsWith("A")).filter(s->s.length()==3).forEach(s-> System.out.println(s));
    }
}
